<template>
  <div>
    <ul class="schedule-list" v-if="schedule.plist">
      <li class="schedule-item" v-for="(e, i) in schedule.plist" :key="i">
        <div class="sc-left-1">
          <p>{{ e.tm }}</p>
          <span>{{ minuteFormate(e.tm) }}</span>
        </div>
        <div class="sc-left-2">
          <p>{{ e.lang }}{{ e.tp }}</p>
          <span>{{ addreTemp(e.th) }}</span>
        </div>
        <div class="sc-right-1">
          <p class="right-1-p1">{{ e.baseSellPrice }}<span>元</span></p>
          <p class="right-1-p2">
            {{ e.vipPriceNameNew }}<span>{{ e.vipPrice }}元</span>
          </p>
        </div>
        <div class="sc-right-2">
          <router-link to="/cinemaVenue"> <p>特惠</p></router-link>
        </div>
      </li>
    </ul>
    <ul class="schedule-list" v-if="!schedule.plist">
      <h3>没有该电影档期</h3>
    </ul>
  </div>
</template>
<script>
export default {
  name: "scheduleMovie",
  props: ["tempSche", "schedule"],
  data() {
    return {
      endMovie: {}, //电影结束时间
      reg: /^(\d)+/,
    };
  },
  methods: {
    minuteFormate(k) {
      // 结束时间
      let arr = [];
      arr = k.split(":");
      //
      let totalTimer = arr[0] * 60 + Number(arr[1]) + this.tempSche.dur;
      // console.log("-总分钟--", totalTimer);
      let hourInt =
        parseInt(totalTimer / 60) < 10
          ? "0" + parseInt(totalTimer / 60)
          : parseInt(totalTimer / 60);
      let mineInt =
        totalTimer % 60 < 10 ? "0" + (totalTimer % 60) : totalTimer % 60;
      return hourInt + ":" + mineInt + "散场";
    },
    addreTemp(k) {
      this.addres = this.reg.exec(k)[0];
      return this.addres + "号厅";
    },
  },
  created() {
    this.$nextTick(() => {
      console.log("档期----->", this.schedule);
      console.log("档期----->", this.tempSche.dur);
    });
  },
  mounted() {
    //  this.totalMinute = this.reg.exec(this.tempArray.desc)[0];
    //  // 处理结束时间
    //  this.minuteFormate("20:20");
  },
};
</script>

<style lang="scss" scoped>
.schedule-list {
  width: 352px;
  margin: 0 auto;
  .schedule-item {
    display: flex;
    font-size: 0;
    padding: 10px 0;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #d4d4d4;
    .sc-left-1 {
      p {
        font-size: 22px;
        font-weight: bold;
        margin-bottom: 5px;
      }
      span {
        font-size: 16px;
        color: #999;
      }
    }
    .sc-left-2 {
      p {
        font-size: 16px;
        margin-bottom: 5px;
      }
      span {
        font-size: 16px;
        color: #999;
      }
    }
    .sc-right-1 {
      .right-1-p1 {
        font-size: 20px;
        color: #dc3934;
        margin-bottom: 5px;
        span {
          font-size: 16px;
          color: #dc3934;
        }
      }
      .right-1-p2 {
        padding: 3px 0;
        font-size: 10px;
        color: #fff;
        background: #ff9000;
        span {
          font-size: 10px;
          color: #ff9000;
          background: #fff;
          border-radius: 1px;
          border: 1px solid #ff9000;
        }
      }
    }
    .sc-right-2 {
      p {
        width: 50px;
        height: 30px;
        text-align: center;
        line-height: 30px;
        font-size: 14px;
        color: #ff9000;
        background: #ffffff;
        border: 1px solid #ff9000;
        border-radius: 20px;
      }
    }
  }
}
</style>